import fly from '@/utils/request'

export default {
    getAllGoods(data) {
        return fly.get('/goods/list',data)
    },
    addGoods(data) {
        return fly.post('/goods/detail',data)
    },
    updateGoods(data) {
        return fly.post('/goods/update',data)
    },
    deleteGoods(data) {
        return fly.post('/goods/delete',data)
    },
    selectBYCategory(data) {
        return fly.get('/goods/selectByCategory',data)
    },
	getGoodsDetialById(data){
		return fly.get('/goods/detail',data)
	},
	getSeckillList(data) {
		return fly.get('/goods/seckill/list', data)
	},
	// 获取秒杀token
	getSeckillToken() {
		return fly.get('/goods/seckill/create/token')
	},
	// 秒杀抢购
	seckill(data) {
		return fly.post('/goods/seckill/Seckill', data)
	},
	// 搜索商品
	searchGoods(data) {
		return fly.get('/goods/selectByName', {
			name: data.keyword || data.name
		})
	},
	// 获取推荐商品
	getRecommendGoods() {
		return fly.get('/goods/selectNameAndPrice')
	}
}